package cn.zyq.ykb.controller.mgt.config;

import org.springframework.security.access.prepost.PreAuthorize;
import cn.zyq.ykb.system.ry.util.poi.ExcelUtil;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.annotation.Log;
import cn.zyq.ykb.system.ry.enums.BusinessType;
import cn.zyq.ykb.beans.config.ConfigHelp;
import cn.zyq.ykb.service.config.ConfigHelpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.common.PageParam;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 配置-帮助手册Controller
 *
 * @author SystemAuth
 * @date 2023-11-27
 */

@RestController(value = "MgtConfigHelpController")
@RequestMapping("/mgt/configHelp")
@Api(tags = "配置-帮助手册接口")
public class ConfigHelpController extends BaseController {

    @Autowired
    private ConfigHelpService configHelpService;

    /**
     * 查询配置-帮助手册列表
     */
    @ApiOperation(value = "列表", response = ConfigHelp.class)
    @PostMapping("/list")
    public Object list(@RequestBody PageParam pageParam) {
        return this.configHelpService.selectConfigHelpList(pageParam);
    }
    /**
     * 获取配置-帮助手册详细信息
     */
    @ApiOperation(value = "详情", response = ConfigHelp.class)
    @GetMapping(value = "/{configHelpID}")
    public Object getInfo(@PathVariable("configHelpID") Integer configHelpID) {
        return this.configHelpService.selectConfigHelpByConfigHelpID(configHelpID);
    }
    /**
     * 获取配置-帮助手册详细信息
     */
    @ApiOperation(value = "详情", response = ConfigHelp.class)
    @GetMapping(value = "/detail/{serviceID}")
    public Object getInfo(@PathVariable(value = "serviceID") String serviceID) {
        return this.configHelpService.selectConfigHelpByServiceID(serviceID);
    }
    /**
     * 新增配置-帮助手册
     */
    @ApiOperation(value = "新增")
    @Log(title = "配置-帮助手册", businessType = BusinessType.INSERT)
    @PostMapping
    public Object add(@RequestBody ConfigHelp configHelp) {
        return this.configHelpService.insertConfigHelp(configHelp);
    }
    /**
     * 修改配置-帮助手册
     */
    @ApiOperation(value = "编辑")
    @Log(title = "配置-帮助手册", businessType = BusinessType.UPDATE)
    @PutMapping
    public Object edit(@RequestBody ConfigHelp configHelp) {
        return this.configHelpService.updateConfigHelp(configHelp);
    }
    /**
     * 删除配置-帮助手册
     */
    @ApiOperation(value = "删除")
    @Log(title = "配置-帮助手册", businessType = BusinessType.DELETE)
    @DeleteMapping("/{configHelpIDs}")
    public Object remove(@PathVariable Integer[] configHelpIDs) {
        return this.configHelpService.deleteConfigHelpByConfigHelpIDs(configHelpIDs);
    }
}
